﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace login
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void bt_login_Click(object sender, EventArgs e)
        {
            string username = tb_username.Text.Trim();
            string password = tb_password.Text;

            if (username.Length == 0 || password.Length == 0)
            {
                MessageBox.Show("请输入用户名或密码！","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
            }

            if (username.Equals("admin") && password.Equals("123"))
            {
                //调用close后，登录窗体关闭，整个程序也关闭了
                //Close();
                Hide();
                Form1 form1 = new Form1();
                form1.Tag = username;
                form1.Show();
            }
            else
            {
                MessageBox.Show("用户名密码错误","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }

        private void bt_quit_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
